<template>
  <div class="page">
    <div class="main">
      <el-card class="box-card" style="height:800px">
        <div slot="header" class="clearfix">
          <span>
            <navigation />
          </span>
        </div>
        <div class="list" id="taskScore">
          <!-- <el-scrollbar class="page-component__scroll" style="height:100%"> -->
          <div style="height:700px;">
            <b
              style="margin-left:10px;font-size:14px;position: relative;top: -10px;"
            >{{ $route.query.name }}</b>
            <el-table
              :header-cell-style="{ background: '#f5f5f5' }"
              border
              :data="tableData"
              style="width: 100%"
              height="680px"
              size="small"
              row-key="id"
              :tree-props="{ children: 'subtasks', hasChildren: 'hasChildren' }"
            >
              <el-table-column label="序号" fixed="left" width="50" type="index" align="center"></el-table-column>
              <el-table-column align="center" label="操作" fixed="left" width="300">
                <template
                  slot-scope="scope"
                  v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                >
                  <el-button type="text" @click="addTask(scope.row)">总任务填报</el-button>
                  <el-button type="text" @click="pathCheck(scope.row)">责任单位进度填报</el-button>
                </template>
              </el-table-column>
              <el-table-column
                align="center"
                width="160"
                prop="targetName"
                fixed="left"
                label="目标任务名称"
              ></el-table-column>
              <el-table-column
                align="center"
                width="160"
                fixed="left"
                label="牵头部门"
                prop="departmentName"
              ></el-table-column>
              <el-table-column align="center" label="一季度">
                <el-table-column align="center" width="80" label="任务量">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >
                    <span v-if="scope.row.oneNumber != null">{{ scope.row.oneNumber }}</span>
                    <span v-else>0</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="实际完成量">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >{{ scope.row.oneQuarterDegree }}</template>
                </el-table-column>
                <el-table-column align="center" width="100" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="进度描述"
                      width="200"
                      trigger="click"
                      v-if="
                        !scope.row.subtasks || scope.row.subtasks.length == 0
                      "
                      :content="scope.row.oneQuarterDegreeDescription"
                    >
                      <el-button slot="reference" class="describe">描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 1)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="本季度完成率">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >{{ decimal(scope.row.degree1) }}</template>
                </el-table-column>
                <el-table-column align="center" label="全年目标完成率">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >{{ decimal(scope.row.allDegree1) }}</template>
                </el-table-column>

                <el-table-column align="center" width="60" label="预警亮灯">
                  <template slot-scope="scope">
                    <img
                      v-if="
                        scope.row.oneQuarterDegreeCaveat == null ||
                        scope.row.oneQuarterDegreeCaveat == 0
                          ? false
                          : true
                      "
                      :src="dataLamp(scope.row.oneQuarterDegreeCaveat)"
                    />
                  </template>
                </el-table-column>

                <el-table-column align="center" width="60" label="审核状态">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >
                    {{
                    degreeStatus(scope.row.oneQuarterDegreeStatus)
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column align="center" label="二季度">
                <el-table-column align="center" width="80" label="任务量">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >
                    <span v-if="scope.row.twoNumber != null">{{ scope.row.twoNumber }}</span>
                    <span v-else>0</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="实际完成量">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >{{ scope.row.twoQuarterDegree }}</template>
                </el-table-column>
                <el-table-column align="center" width="100" label="描述">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >
                    <el-popover
                      placement="top-start"
                      title="进度描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.twoQuarterDegreeDescription"
                    >
                      <el-button slot="reference" class="describe">描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 2)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="本季度完成率">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >{{ decimal(scope.row.degree2) }}</template>
                </el-table-column>
                <el-table-column align="center" label="全年目标完成率">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >{{ decimal(scope.row.allDegree2) }}</template>
                </el-table-column>
                <el-table-column align="center" width="60" label="预警亮灯">
                  <template slot-scope="scope">
                    <img
                      v-if="
                        scope.row.twoQuarterDegreeCaveat == null ||
                        scope.row.twoQuarterDegreeCaveat == 0
                          ? false
                          : true
                      "
                      :src="dataLamp(scope.row.twoQuarterDegreeCaveat)"
                    />
                  </template>
                </el-table-column>
                <el-table-column align="center" width="60" label="审核状态">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >
                    {{
                    degreeStatus(scope.row.twoQuarterDegreeStatus)
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column align="center" label="三季度">
                <el-table-column align="center" width="80" label="任务量">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >
                    <span v-if="scope.row.threeNumber != null">{{ scope.row.threeNumber }}</span>
                    <span v-else>0</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="实际完成量">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >{{ scope.row.threeQuarterDegree }}</template>
                </el-table-column>
                <el-table-column align="center" width="100" label="描述">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >
                    <el-popover
                      placement="top-start"
                      title="进度描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.threeQuarterDegreeDescription"
                    >
                      <el-button slot="reference" class="describe">描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 3)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="本季度完成率">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >{{ decimal(scope.row.degree3) }}</template>
                </el-table-column>
                <el-table-column align="center" label="全年目标完成率">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >{{ decimal(scope.row.allDegree3) }}</template>
                </el-table-column>
                <el-table-column align="center" width="60" label="预警亮灯">
                  <template slot-scope="scope">
                    <img
                      v-if="
                        scope.row.threeQuarterDegreeCaveat == null ||
                        scope.row.threeQuarterDegreeCaveat == 0
                          ? false
                          : true
                      "
                      :src="dataLamp(scope.row.threeQuarterDegreeCaveat)"
                    />
                  </template>
                </el-table-column>
                <el-table-column align="center" width="60" label="审核状态">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >
                    {{
                    degreeStatus(scope.row.threeQuarterDegreeStatus)
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column align="center" label="全年">
                <el-table-column align="center" width="80" prop="allNumber" label="任务量">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >
                    <span v-if="scope.row.allNumber != null">{{ scope.row.allNumber }}</span>
                    <span v-else>0</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="实际完成量">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >{{ scope.row.allDegree }}</template>
                </el-table-column>
                <el-table-column align="center" width="100" label="描述">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >
                    <el-popover
                      placement="top-start"
                      title="进度描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.allDegreeDescription"
                    >
                      <el-button slot="reference" class="describe">描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 4)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="60" label="本季度完成率">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >{{ decimal(scope.row.degree4) }}</template>
                </el-table-column>
                <el-table-column align="center" width="60" label="全年目标完成率">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >{{ decimal(scope.row.allDegree4) }}</template>
                </el-table-column>
                <el-table-column align="center" width="60" label="预警亮灯">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >
                    <img
                      v-if="
                        scope.row.allDegreeCaveat == null ||
                        scope.row.allDegreeCaveat == 0
                          ? false
                          : true
                      "
                      :src="dataLamp(scope.row.allDegreeCaveat)"
                    />
                  </template>
                </el-table-column>
                <el-table-column align="center" width="60" label="审核状态">
                  <template
                    slot-scope="scope"
                    v-if="!scope.row.subtasks || scope.row.subtasks.length == 0"
                  >{{ degreeStatus(scope.row.allDegreeStatus) }}</template>
                </el-table-column>
              </el-table-column>
            </el-table>
          </div>
          <!-- </el-scrollbar> -->
        </div>
      </el-card>
    </div>

    <el-dialog title="进度填报" center :visible.sync="dialogschedule" width="30%">
      <div>
        <el-form ref="form" :model="form" label-width="110px">
          <el-form-item label="任务名称">
            <el-input type="text" v-model="form.taskName"></el-input>
          </el-form-item>
          <el-form-item label="牵头部门">
            <el-input type="text" v-model="form.unitName"></el-input>
          </el-form-item>
          <el-form-item label="季度" prop="quarter">
            <el-select
              class="userIntSize"
              style="width:100%"
              @change="backLoop()"
              v-model="form.quarter"
              clearable
            >
              <el-option
                v-for="(item, index) in quarterList"
                :key="index"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="实际任务完成量">
            <el-input type="text" v-model="form.QuarterDegree"></el-input>
          </el-form-item>
          <el-form-item label="描述">
            <el-input type="text" v-model="describe"></el-input>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogschedule = false">取 消</el-button>
        <el-button type="primary" @click="dataGrade()">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 附件列表弹框 -->
    <el-dialog
      width="60%"
      title="附件列表配置"
      :visible.sync="dialogFormVisible"
      :close-on-click-modal="false"
      @closed="closeDialog"
    >
      <el-form :inline="true" label-width="95px" :model="dutyFrom" :hide-required-asterisk="false">
        <el-form-item label="附件：" prop="file">
          <el-upload
            class="upload-demo"
            :action="uploadUrl"
            :on-success="successFile"
            :on-remove="handleDealFileRemove"
            :file-list="fileList"
            multiple
            ref="rebateUpload"
          >
            <el-button size="small" type="primary">点击上传</el-button>
          </el-upload>
        </el-form-item>
        <el-form-item>
          <el-button size="small" class="saveBtn" type="primary" @click="submitForm">添加</el-button>
        </el-form-item>
      </el-form>
      <el-table
        :data="fileTableData"
        border
        style="width: 100%"
        :header-cell-style="{ background: '#eef1f6', color: '#606266' }"
      >
        <el-table-column prop="file" label="附件名称">
          <template slot-scope="scope">
            <a :href="returnFile(scope.row.file)">{{ scope.row.file }}</a>
          </template>
        </el-table-column>
        <el-table-column label="上传时间">
          <template slot-scope="scope">{{ scope.row.fileAddTime }}</template>
        </el-table-column>
        <el-table-column label="上传人" prop="userName"></el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button type="danger" @click="deleteFile(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>
<script>
import configJson from "../../../api/config";
export default {
  data() {
    return {
      pageNum: 1,
      pageSize: 10,
      dialogVisible: false,
      dialogGrade: false,
      dialogschedule: false,
      options: [],
      value: "",
      value1: true,
      dialogFormVisible: false,
      fileQuarter: 1,
      secondAimsId: "",
      fileTableData: [],
      input: "",
      tableData: [],
      total: 0,
      multipleSelection: [],
      currentPage1: 5,
      currentPage2: 5,
      currentPage3: 5,
      currentPage4: 4,
      departmentName: "",
      textarea: "",
      allNumberId: "",
      allNumber: "",
      currVal: {},
      form: {
        id: "",
        taskName: "", //任务名称
        unitName: "", //牵头单位
        subtasksId: "",
        quarter: "",
        QuarterDegree: "", //实际完成量

        completionDegree: "",
        oneQuarterDegree: "",
        oneQuarterDegreeDescription: "",
        twoQuarterDegree: "",
        twoQuarterDegreeDescription: "",
        threeQuarterDegree: "",
        threeQuarterDegreeDescription: "",
        allDegree: "",
        allDegreeDescription: "",
      },
      objCurr: {
        type: true,
        id: "",
        taskId: "",
        year: "",
        time: "",
        score: "",
      },
      // 附件上传模块
      dutyFrom: {
        id: "",
        taskId: "",
        year: "",
        quarter: "",
        file: [],
        fileType: "",
      },
      fileName: "",
      quarterList: [
        { id: 1, name: "第一季度" },
        { id: 2, name: "第二季度" },
        { id: 3, name: "第三季度" },
        { id: 4, name: "全年" },
      ],
      input2: "",
      subtasksId: "",
      uploadUrl: configJson.API_URL + "fileController/uploadFile", //地址
      fileList: [],
      valCurr: {}, //当前列表的所有数据
      describe: "", //描述
    };
  },
  mounted() {
    this.subtasksId = this.$route.query.id;
    this.departmentName = this.$route.query.departmentName;
    this.getListByPage();
  },
  // 计算属性
  computed: {},
  methods: {
    // 上传附件列表
    handFileList(row, index) {
      this.secondAimsId = "";
      console.log(row);
      this.secondAimsId = row.id;
      this.fileQuarter = index;
      this.getfileList();
      this.dialogFormVisible = true;
    },
    // 获取附件列表
    getfileList() {
      this.$axios
        .post(`/fileController/getListDaily`, {
          taskId: this.$route.query.id,
          secondAimsId: this.secondAimsId,
          fileQuarter: this.fileQuarter,
          type: 1,
        })
        .then((res) => {
          if (res.code == 200) {
            console.log(res);
            this.fileTableData = res.data;
            this.fileName = "";
            this.fileList = [];
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    // 添加附件
    submitForm() {
      if (this.dutyFrom.file == "") {
        this.$message.error("请选择附件");
      }
      let _obj = {
        aimsId: this.$route.query.id,
        files: this.dutyFrom.file,
        secondAimsId: this.secondAimsId,
        type: "1",
        fileQuarter: this.fileQuarter,
      };
      this.$axios
        .post(`fileController/addFile`, _obj)
        .then((res) => {
          if (res.code == 200) {
            console.log(res);
            this.$message({
              message: "数据更新成功",
              type: "success",
            });
            this.closeDialog();
            this.getfileList();
            this.dutyFrom.fileQuarter = "";
            this.dutyFrom.file = [];
            // this.secondAimsId = "";
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    returnFile(val) {
      return `${configJson.API_URL}/fileController/${val}`;
    },
    closeDialog() {
      this.dutyFrom = {
        year: "",
        quarter: "",
        file: [],
        taskId: "",
        id: "",
        fileType: "",
      };
    },
    // 审核状态
    degreeStatus(val) {
      let _text = "";
      switch (val) {
        case 0:
          _text = "未提交";
          break;
        case 1:
          _text = "审核中";
          break;
        case 2:
          _text = "通过";
          break;
        default:
          _text = "驳回";
      }
      return _text;
    },

    // 保留小数点后两位
    decimal(val) {
      let _val = val * 100;
      _val = _val.toFixed(2);
      return _val + "%";
    },
    // 选择附件
    successFile(response, file, fileList) {
      console.log(response);
      if (response.code == 200) {
        this.fileList = fileList;
        console.log(this.fileList);
        let fileUrlStr = this.uploadUrl.split("/");
        let fileRemoveChl = fileUrlStr.slice(0, fileUrlStr.length - 1);
        this.fileUrlEnd = fileRemoveChl.join("/");
        this.fileName = this.fileUrlEnd + "/" + response.data;
        console.log(response.data);
        let _text = response.data;

        console.log(Array.isArray(this.dutyFrom.file));
        console.log(this.dutyFrom.file);
        this.dutyFrom.file.push(_text); //获取上传文件名
        console.log(this.dutyFrom.file);
      }
    },
    handleDealFileRemove(file, fileList) {
      this.fileList = fileList;
      this.fileName = "";
    },
    uploadExceed(files, fileList) {
      this.$set(fileList[0], "raw", files[0]);
      this.$set(fileList[0], "name", files[0].name);
      this.$refs["rebateUpload"].clearFiles(); //清除文件
      this.$refs["rebateUpload"].handleStart(files[0]); //选择文件后的赋值方法
      this.fileName = this.fileUrlEnd + "/" + files[0].name;
    },
    // 删除列表附件
    deleteFile(val) {
      this.$axios
        .post(
          `/fileController/deleteFileLib`,
          {
            id: val.id,
          },
          2
        )
        .then((res) => {
          if (res.code == 200) {
            console.log(res);
            this.$message({
              message: "数据更新成功",
              type: "success",
            });
            this.getfileList();
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    // 删除
    deleteRow(val) {
      this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$axios
            .post(`/subtaskDegree/remove`, {
              id: val.id,
            })
            .then((res) => {
              if (res.code == 200) {
                console.log(res);
                this.$message({
                  message: "数据更新成功",
                  type: "success",
                });
                this.getListByPage();
              }
            })
            .catch((err) => {
              console.log(err);
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    //任务回填
    backLoop() {
      this.$axios
        .post(`/distribution/load`, { id: this.form.id })
        .then((res) => {
          if (res.code == 200) {
            let _data = res.data;
            let _this = this.form;
            switch (_this.quarter) {
              case 1:
                _this.QuarterDegree = _data.oneQuarterDegree;
                this.describe = _data.oneQuarterDegreeDescription;
                break;
              case 2:
                _this.QuarterDegree = _data.twoQuarterDegree;
                this.describe = _data.twoQuarterDegreeDescription;
                break;
              case 3:
                _this.QuarterDegree = _data.threeQuarterDegree;
                this.describe = _data.threeQuarterDegreeDescription;
                break;
              default:
                _this.QuarterDegree = _data.allDegree;
                this.describe = _data.allDegreeDescription;
            }
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    dataLamp(val) {
      let _url = "";
      if (val == 1) {
        _url = require("../../../assets/img/yellowLight.png");
      } else {
        _url = require("../../../assets/img/redLight.png");
      }
      return _url;
    },
    // 点击任务填报
    addTask(val) {
      this.form.id = val.id;
      this.dialogschedule = true;
      this.valCurr = val;
      let _this = this.form;
      _this.taskName = val.targetName;
      _this.unitName = this.departmentName;
      _this.quarter = "";
      _this.QuarterDegree = "";
    },
    // 列表查看
    pathCheck(val) {
      this.$router.push({
        path: "/targetListboyTow",
        query: { id: val.id, name: val.targetName },
      });
    },
    setCheck(val) {
      this.$router.push({
        path: "/cooperateList",
        query: { parentId: this.taskId, id: val.id },
      });
    },
    setGrade(val) {
      console.log(val);
      for (const key in this.objCurr) {
        this.objCurr[key] = "";
      }
      this.objCurr.taskId = val.id;
      this.objCurr.type = true;
      this.dialogGrade = true;
    },
    // 点击弹出框列表确认按钮
    dataGrade() {
      let _this = this.form;
      // if (_this.completionDegree == "") {
      //   this.$message.error("请用户填填完输入框");
      //   return;
      // }
      if (isNaN(_this.QuarterDegree)) {
        this.$message.error("请用户输入数字");
        return;
      }
      let _isType = "";

      switch (_this.quarter) {
        case 1:
          _this.oneQuarterDegree = _this.QuarterDegree;
          _isType = this.valCurr.oneQuarterDegreeStatus;
          _this.oneQuarterDegreeDescription = this.describe;
          break;
        case 2:
          _this.twoQuarterDegree = _this.QuarterDegree;
          _isType = this.valCurr.twoQuarterDegreeStatus;
          _this.twoQuarterDegreeDescription = this.describe;
          break;
        case 3:
          _this.threeQuarterDegree = _this.QuarterDegree;
          _isType = this.valCurr.threeQuarterDegreeCaveat;
          _this.threeQuarterDegreeDescription = this.describe;
          break;
        default:
          _this.allDegree = _this.QuarterDegree;
          _isType = this.valCurr.allDegreeStatus;
          _this.allDegreeDescription = this.describe;
      }

      if (_isType == 1 || _isType == 2) {
        this.$message.error("季度处于“审核中”或“通过”，无法修改");
        return;
      }
      // if (!/(^[1-9]\d*$)/.test(_this.completionDegree)) {
      //   this.$message.error("请用户在分数内写入1-100的正整数");
      //   return;
      // }
      this.$axios
        .post(`/distribution/update`, this.form)
        .then((res) => {
          if (res.code == 200) {
            console.log(res);
            this.$message({
              message: "数据更新成功",
              type: "success",
            });
            this.dialogschedule = false;
            this.getListByPage();
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    dataTotal(val) {
      this.pageNum = val;
    },
    // 表格数组
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    // 列表查看按钮
    routerPath(val) {
      this.$router.go(-1);
    },
    // 编写备注
    dataRemark() {
      this.dialogVisible = true;
    },
    // 获取数据列表
    getListByPage() {
      console.log(this.subtasksId);
      let _obj = {
        taskId: +this.subtasksId,
      };
      this.$axios
        .post(`/distribution/getList`, _obj)
        .then((res) => {
          if (res.code == 200) {
            console.log(res);
            this.tableData = res.data;
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};
</script>
<style scoped>
.page {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.main {
  width: 100%;
  height: 100%;
}
.subnav {
  float: left;
  width: 100%;
  height: 60px;
  line-height: 60px;
}
.searchLeft {
  float: left;
  width: 400px;
}
.describe {
  padding: 4px 4px;
}
.searchLeft > button {
  width: 100px;
  height: 40px;
  background: #409eff;
  color: #fff;
  border: 0px;
  font-size: 16px;
  text-align: center;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  position: relative;
  left: -8px;
  top: 1px;
}
.searchRight {
  float: left;
  width: auto;
}
.striping > b {
  font-weight: 500;
  font-size: 14px;
}
.searchRight > span {
  display: inline-block;
  width: 80px;
  height: auto;
  font-size: 14px;
  text-align: center;
  margin-left: 20px;
}
.el-scrollbar__wrap {
  overflow-x: hidden;
}
.page-component__scroll {
  height: 100%;
}
.list {
  width: 100%;
  height: 100%;
  padding-bottom: 60px;
}
.laypage {
  width: 100%;
  height: 60px;
  position: relative;
  top: -60px;
  text-align: right;
}
</style>
<style>
#taskScore .el-scrollbar__wrap {
  overflow: visible;
  overflow-y: scroll;
}
</style>
